package com.mer.controller;

import com.mer.entity.Course;
import com.mer.service.CourseService;
import com.mer.vo.CommonResult;
import com.mer.vo.CourseVo;
import com.mer.vo.ModifyCourseVo;
import com.mer.vo.UploadCourseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: IIPhase-project
 * @description: 课程控制层
 * @author: 陈铠
 * @create: 2021-10-20 19:44
 **/
@RestController
@RequestMapping("/core/course")
@Api("课程列表接口")
public class CourseController {
    @Resource
    private CourseService courseService;

    @PostMapping("/selectCourse/{page}/{limit}")
    @ApiOperation("分页查询课程")
    public CommonResult selectCourseByPage(@PathVariable("page") Integer page, @PathVariable("limit") Integer limit, @RequestBody CourseVo courseVo, String id) {
        return courseService.selectCourseByPage(page, limit, courseVo, id);
    }

    @PostMapping("/modifyCourse")
    @ApiOperation("修改课程信息")
    public CommonResult modifyCourse(@RequestBody ModifyCourseVo modifyCourseVo) {
        return courseService.modifyCourse(modifyCourseVo);
    }

    @PostMapping("/changeStatus")
    @ApiOperation("修改状态信息")
    public CommonResult changeStatus(@RequestBody CourseVo courseVo) {
        return courseService.changeStatus(courseVo);
    }

    @PostMapping("/updateCourseSubject")
    @ApiOperation("讲师修改或上传课程信息")
    public CommonResult updateCourseSubject(@RequestBody UploadCourseVo uploadCourseVo) {
        return courseService.updateCourseSubject(uploadCourseVo);
    }
}
